let container = document.querySelector('#container')

let regExp = /^<[^<]+\s+src="([^''""]*)"/

let id = getQueryString("productid")
console.log(id);

fetch('http://chst.vip:1234/api/getdiscountproduct?productid=' + id)
    .then(body => body.json())
    .then(res => {
        console.log(res);

        let data = res.result[0];
     let html = `
        <h2>${data.productName}</h2>
        <div>
            <span>${data.productFrom} | ${data.productTime}</span>
            <span>${data.productTips}</span>
        </div>
        <div>
            <p>${data.productInfo}</p>
        </div>
        <div id="pigImg">
        ${data.productImg}  
        </div>
    ` 
        container.innerHTML = html
    })
